package me.notelife.svnmonitor.dao;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class ConnectionFactory
{
    private static SqlSessionFactory sqlMapper;
    private static Reader reader;

    static
    {
        try
        {
            reader = Resources.getResourceAsReader( "mybatis.config.xml" );
        }
        catch( IOException e )
        {
            e.printStackTrace();
        }
        sqlMapper = new SqlSessionFactoryBuilder().build( reader );
    }

    public static SqlSessionFactory getSession()
    {
        return sqlMapper;
    }
}